<template>
  <div>
    <div v-show="visible" class="global-loading">
      <el-loading :text="text" :spinner="spinner"></el-loading>
    </div>
  </div>
</template>

<script>
export default {
  name: 'glo',
  data () {
    return {
      visible: false,
      text: '加载中...',
      spinner: 'el-icon-loading'
    }
  },
  methods: {
    show () {
      this.visible = true
    },
    hide () {
      this.visible = false
    }
  }
}
</script>

<style scoped>
.global-loading {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 9999;
}
</style>
